package button;

import java.awt.event.*;

public class ChoiceButton extends MyButton{
	
	public ChoiceButton(int x, int y, int width, int height){
		super(x, y, width, height);
	}
	public void pressed(MouseEvent e){
		if(isActive){
			int mouseX = e.getX();
			int mouseY = e.getY();
			if(isWithinButton(mouseX, mouseY)){
				isPressed = true;
			}
		}
	}
	
	public void released(MouseEvent e){
		isPressed = false;
		
	}
	
	
	public boolean isWithinButton(int mouseX, int mouseY){
		if(mouseX >= x && mouseX <= (width + x -1) && mouseY >= y && mouseY <= (height + y - 1)){
			return true;
		}
		return false;
	}
}
